package ex105;

public class Calendar {
    int year;
    int weekDigitOfFirstDay; //

    int[] getFirstWeekDigitsOfMonth() {
        int[] result = new int[12];
        for (int month = 1, days = 0; month <= 12; month++) {
            result[month - 1] = (days + weekDigitOfFirstDay) % 7;
            days += switch (month) {
                case 1, 3, 5, 7, 8, 10, 12 -> 31;
                case 4, 6, 9, 11 -> 30;
                case 2 -> (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) ? 29 : 28;
                default -> 0;
            };
        }
        return result;
    }
}
